<?php

/**
 * 货品管理
 */
namespace app\shop\model;

use app\system\model\SystemModel;

class ShopProductsModel extends SystemModel {

    protected $infoModel = [
        'pri' => 'products_id'
    ];

    public function loadList($where = [], $limit = 0, $order = '') {
        return parent::loadList($where, $limit, 'products_id asc');
    }

    public function getShopInfo($proId) {
       $info = $this->table('shop_products(A)')
            ->join('shop(B)', ['B.shop_id', 'A.shop_id'])
            ->join('site_content(C)', ['C.content_id', 'B.content_id'])
            ->field(['C.*',  'B.*', 'A.*'])
            ->where(['A.products_id' => $proId])->find();
        $info['spec_data'] = unserialize($info['spec_data']);
        return $info;
    }

}